﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="ListProperties.aspx.cs" Inherits="SES.CMS.AdminCP.ListProperties" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
        Thuộc tính của danh mục sản phẩm</h2>
    <div style="float: right; width: 100%;">
        <span style="float: left">Chọn danh mục
            <asp:DropDownList runat="server" ID="ddlParentCate" AppendDataBoundItems="true" AutoPostBack="true"
                OnSelectedIndexChanged="ddlParentCate_SelectedIndexChanged">
                <asp:ListItem Text=".: Danh mục cao nhất :." Value="0"></asp:ListItem>
            </asp:DropDownList>
        </span><span style="float: right">
            <asp:Button runat="server" ID="btnAddNewRecord" Text="Thêm bản ghi thuộc tính" CssClass="button"
                OnClick="AddNewRecord" /></span>
    </div>
    <asp:GridView ID="grvProperties" DataKeyNames="PropertyID" runat="server" AutoGenerateColumns="False"
        CssClass="tstyle2" PageSize="35" AllowPaging="true" Width="100%" PagerStyle-CssClass="pgr"
        OnRowCancelingEdit="grvProperties_RowCancelingEdit" OnRowEditing="grvProperties_RowEditing"
        OnRowUpdating="grvProperties_RowUpdating" OnRowCommand="grvProperties_RowCommand"
        OnRowDeleting="grvProperties_RowDeleting">
        <Columns>
            <asp:TemplateField HeaderText="PropertyID" ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblPropertyID" Text='<%#Eval("PropertyID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
              <asp:TemplateField HeaderText="Mã thuộc tính" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblPropertyCode" Text='<%#Eval("PropertyCode") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox runat="server" ID="txtPropertyCode" Text='<%#Eval("PropertyCode") %>'
                            Width="70px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatora4" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtPropertyCode" ValidationGroup="vlProperty"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:TextBox runat="server" ID="txtFPropertyCode" Text="" Width="70px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorb4" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtFPropertyCode" ValidationGroup="vlfProperty"></asp:RequiredFieldValidator>
                    </FooterTemplate>
                </asp:TemplateField>
            <asp:TemplateField HeaderText="Tên thuộc tính" ItemStyle-Width="30%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblPropertyName" Text='<%#Eval("PropertyName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox runat="server" ID="txtPropertyName" Text='<%#Eval("PropertyName") %>'
                        Width="150px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorc4" runat="server" ErrorMessage="*"
                        ForeColor="Red" ControlToValidate="txtPropertyName" ValidationGroup="vlProperty"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox runat="server" ID="txtFPropertyName" Text="" Width="150px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidatord4" runat="server" ErrorMessage="*"
                        ForeColor="Red" ControlToValidate="txtFPropertyName" ValidationGroup="vlfProperty"></asp:RequiredFieldValidator>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Kiểu dữ liệu" ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblPropertyType" Text='<%#Eval("PropertyType") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList runat="server" ID="ddlPropertyType" DataSource='<%#SES.CMS.AdminCP.Functions.DataType()%>'
                        DataTextField="PropertyNameInput" DataValueField="PropertyTypeInput">
                    </asp:DropDownList>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:DropDownList runat="server" ID="ddlfPropertyType" DataSource='<%#SES.CMS.AdminCP.Functions.DataType()%>'
                        DataTextField="PropertyNameInput" DataValueField="PropertyTypeInput">
                    </asp:DropDownList>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Danh mục sản phẩm" ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblProductCategoryTitle" Text='<%#Eval("ProductCategoryTitle") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label runat="server" ID="lblfProductCategoryTitle" Text='<%#ProductCategoryTitle()%>'></asp:Label>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="true" HeaderText="Sửa thuộc tính" ItemStyle-Width="10%"
                CausesValidation="false" />
            <asp:TemplateField HeaderText="Xóa bản ghi" ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:ImageButton ID="btDelete" runat="server" CommandArgument='<%#Eval("PropertyID") %>'
                        CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Button ID="btnInsert" runat="Server" Text="Insert" CssClass="button" CommandName="Insert"
                        UseSubmitBehavior="False" ValidationGroup="vlfProperty" />
                    <asp:Button ID="btnCancel" runat="Server" Text="Cancel" CssClass="button" CommandName="Cancel"
                        UseSubmitBehavior="False" />
                </FooterTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <h2>
                Danh mục hiện tại chưa có bản ghi thuộc tính nào! Nhập thuộc tính cho danh mục sản
                phẩm</h2>
            <table class="tablet">
                <tr>
                    <td>
                        Mã thuộc tính
                        <asp:TextBox runat="server" ID="txtPropertyCode" Width="70px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtPropertyCode" ValidationGroup="vlEmpProperty"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        Tên thuộc tính
                        <asp:TextBox runat="server" ID="txtEmptyPropertyName" Width="150px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatore4" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtEmptyPropertyName" ValidationGroup="vlEmpProperty"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        Kiểu dữ liệu
                        <asp:DropDownList runat="server" ID="ddlEmpPropertyType" DataSource='<%#SES.CMS.AdminCP.Functions.DataType()%>'
                            DataTextField="PropertyNameInput" DataValueField="PropertyTypeInput">
                        </asp:DropDownList>
                    </td>
                    <td>
                        Danh mục sản phẩm: <span style="color: #000; font-weight: bold;">
                            <%#ProductCategoryTitle()%>
                        </span>
                    </td>
                    <td>
                        <asp:Button ID="btnInsert" runat="Server" Text="Insert" CommandName="EmptyInsert"
                            ValidationGroup="vlEmpProperty" UseSubmitBehavior="False" CssClass="button" />
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
    </asp:GridView>
</asp:Content>
